;

; assoc
(assoc green
((red . "ff0000")
(green . "00ff00")
(blue . "0000ff"))) => (green . "00ff00")

(assoc-string )

(setq x '(a b c))
(setq y '(d e f))
(setq z '(g h i))
(append x y z) (a b c d e f g h i)


; while
(while true-or-false-test
body...)

; condition: if when unless

(when condition a b c)

(if condition (progn a b c) nil)

(if t (insert "abc") (progn ()()))

(unless condition a b c)

(setq a 5)
(cond ((eq a 'hack) 'foo)
      (t "default"))
=> "default"

; number equal
(= 2 2)


;; hash table

(setq myHash (make-hash-table :test 'equal))

(puthash "mary" "19" myHash)
(puthash "jane" "20" myHash)
(puthash "carrie" "17" myHash)

(gethash "mary" myHash)
(setq v (vector 3 4 5))

(length v)
;Getting a Element
(elt v 0)


[[1 2] [3 4]] ; 2 by 2 matrix
[8 [3 [2 9] c] 7 [4 "b"]] ; random nested vector

(mapcar '1+ [3 4 5])

;; get first element of each row
(mapcar (lambda (x) (elt x 0)) [[1 2] [3 4]])

(setq tags-file-name "{/SOURCE/CODE/PATH}/TAGS")
(setq tags-file-name "c:/Program Files/Microsoft SDKs/Windows/v7.0A/Include/TAGS")
(mapcar (lambda (x) (elt x 0)) [[1 2] [3 4]])

;; stringp test whether is string
(stringp "file") result is true
;; to test whether parameter user pass in is string. if not, 
  (or (stringp file) (signal 'wrong-type-argument (list 'stringp file)))

(defun abc(file &optional local)
  (interactive (list (read-file-name "Visit tags table (default TAGS): "
				     default-directory
				     (expand-file-name "TAGS"
						       default-directory)
				     t)
		     current-prefix-arg))
  (print default-directory)
  (print current-prefix-arg)
  (print file)

  (let ((tags-file-name file))
    (print tags-file-name)
    )
  )

(defun visit-tags-table-buffer-reading()
  
  )
;; to print out current local variable
(buffer-local-variables)

(error "user \\[abc-def]")

;; what (or x y) what or do is to find whether x is true, if so , sexp y will
;; not be invoked/eval.
(setq abc 1)

(or (stringp abc) (print "abc is not string"))

;; assq/rassq and assoc/rassoc tutorial
;; assq-delete-all
(setq trees '((pine . cones) (oak . acorns) (maple . seeds)))
(assoc 'oak trees)
(assq 'pine trees)
(rassq 'cones trees)
(assq-delete-all 'pine trees)

(defun switch-two-buffer-two-window()
  (interactive)
  (let ((buf-one (buffer-name))
        buf-two
        )
    (other-window 1)
    (setq buf-two (buffer-name))
    (switch-to-buffer buf-one)
    (other-window 1)
    (switch-to-buffer buf-two)
    )
  )
        
    
        
(x-popup-menu
 t
 '("Title"
   ("Title 1" ("Item 1-1" . 11) ("Item 1-2" . 12))
   ("Title 2" ("Item 2-1" . 21) ("Item 2-2" . 22))))